<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="resource/css/bootstrap.css">
    <script type="text/javascript" src="resource/js/jquery-3.2.1.js"></script>
</head>
<body>
    <form action="list" method="post">
        <input type="hidden" name="pageNum">
        <table class="table">
            <tr>
                <td colspan="22">
                    外发单号:<input type="text" name="odd" value="${vo.odd}">
                    工号:<input type="text" name="jobnum" value="${vo.jobnum}">
                    姓名:<input type="text" name="name" value="${vo.name}">
                    外发日期:<input type="date" name="d1" value="<fmt:formatDate value="${vo.d1}" pattern="yyyy-MM-dd"></fmt:formatDate>">至
                            <input type="date" name="d2" value="<fmt:formatDate value="${vo.d2}" pattern="yyyy-MM-dd"></fmt:formatDate>">
                    <input type="submit" value="提交">
                </td>
            </tr>
            <tr>
                <td>外发日期</td>
                <td>外发单号</td>
                <td>工号</td>
                <td>姓名</td>
                <td>商品编号</td>
                <td>商品名称</td>
                <td>型号</td>
                <td>规格</td>
                <td>单价</td>
                <td>数量</td>
                <td>金额</td>
                <td>备注</td>
                <td>操作</td>
            </tr>
            <c:forEach var="work" items="${info.list}">
                <tr>
                    <td><fmt:formatDate value="${work.sdate}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
                    <td>${work.odd}</td>
                    <td>${work.jobnum}</td>
                    <td>${work.name}</td>
                    <td>${work.gnum}</td>
                    <td>${work.gname}</td>
                    <td>${work.model}</td>
                    <td>${work.specification}</td>
                    <td>${work.price}</td>
                    <td>${work.num}</td>
                    <td>${work.money}</td>
                    <td>${work.comment}</td>
                    <td>
                        <a href="toUpdate?odd=${work.odd}">编辑</a>
                        <input type="button" value="删除" onclick="del('${work.odd}')">
                    </td>
                </tr>
            </c:forEach>
            <tr>
                <td colspan="22">
                    <jsp:include page="/resource/page/pages.jsp"></jsp:include>
                </td>
            </tr>
        </table>
    </form>

    <script type="text/javascript">
        function goPage(pageNum){
            $("[name='pageNum']").val(pageNum);
            $("form").submit();
        }
        //删除
        function del(odd){
            if (confirm("你确定要删除吗?")){
                location="del?odd="+odd;
            }
        }
    </script>
</body>
</html>
